﻿using carShop.Models;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace carShop.Data.EntityFramework
{

    public class CarShopDbContext : IdentityDbContext<User>
    {
        public CarShopDbContext()
            : base("DefaultConnection")
        {
            
        }
        public DbSet<Car> Car { get; set; }
        public DbSet<Video> Video { get; set; }
        public DbSet<Image> Image { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //run first the onmodelcreation for IdentityDbContext
            base.OnModelCreating(modelBuilder);


            modelBuilder.Configurations.Add(new CarConfiguration());
            modelBuilder.Configurations.Add(new ImageConfiguration());
            modelBuilder.Configurations.Add(new VideoConfiguration());
            modelBuilder.ComplexType<Specification>();
        }
    }
}